package training;

import java.util.*;

/**
 * @Author liangzai
 * @Description:
 */
public class J25_5_8_Training {
    //全排列的价值
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

    }

    //全排列 2
    public List<List<Integer>> retList ;
    public HashSet<List<Integer>> set;
    public List<Integer> path;
    public boolean[] cheak;
    public List<List<Integer>> permuteUnique(int[] nums) {
        retList = new ArrayList<>();
        path = new ArrayList<>();
        set = new HashSet<>();
        cheak = new boolean[nums.length];
        dfs(nums);
        return retList;
    }

    private void dfs(int[] nums) {
        if (path.size() == nums.length) {
            if(!set.contains(path)){
                set.add(new ArrayList<>(path));
                retList.add(new ArrayList<>(path));
            }
            return ;
        }
        for (int i = 0; i < nums.length; i++) {
            if(cheak[i] == false){
                path.add(nums[i]);
                cheak[i] = true;
                dfs(nums);
                path.remove(path.size()-1);
                cheak[i] = false;
            }
        }
    }

//    public static void main(String[] args) {
//        boolean[] cheak = new boolean[3];
//        System.out.println(Arrays.toString(cheak));
//    }
}






